<!DOCTYPE html>
<html   xmlns="http://www.w3c.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <script type="text/javascript">
            PrimeFaces.locales['tr'] = {
                closeText: 'kapat',
                prevText: 'geri',
                nextText: 'ileri',
                currentText: 'bugün',
                monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
                    'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
                monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
                    'Tem','Ağu','Eyl','Eki','Kas','Ara'],
                dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
                dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
                dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
                weekHeader: 'Hf',
                firstDay: 1,
                isRTL: false,
                showMonthAfterYear: false,
                yearSuffix: '',
                month: 'Ay',
                week: 'Hafta',
                day: 'Gün',
                allDayText : 'Tüm Gün'
            };
        </script>
        <style type="text/css">
            .value {
                width: 1000px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form>
            <p:growl id="messages" showDetail="true" />

            <h:panelGrid columnClasses="value">
                <h3 style="margin-top: 0">Editable Schedule</h3>
                <p:schedule id="schedule" value="#{scheduleBean.eventModel}" widgetVar="myschedule" timeZone="GMT+2">

                    <p:ajax event="dateSelect" listener="#{scheduleBean.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
                    <p:ajax event="eventSelect" listener="#{scheduleBean.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
                    <p:ajax event="eventMove" listener="#{scheduleBean.onEventMove}" update="messages" />
                    <p:ajax event="eventResize" listener="#{scheduleBean.onEventResize}" update="messages" />

                </p:schedule>

                <h3>Locale Support ( Example: Turkish )</h3>
                <p:schedule id="scheduleLocale" value="#{scheduleBean.eventModel}" locale="tr" />

                <h3>Lazy Schedule</h3>
                <p:schedule value="#{scheduleBean.lazyEventModel}" />
            </h:panelGrid>

            <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
                <h:panelGrid id="eventDetails" columns="2">
                    <h:outputLabel for="title" value="Title:" />
                    <p:inputText id="title" value="#{scheduleBean.event.title}" required="true" />

                    <h:outputLabel for="from" value="From:" />
                    <p:inputMask id="from" value="#{scheduleBean.event.startDate}" mask="99/99/9999">
                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT+2"/>
                    </p:inputMask>

                    <h:outputLabel for="to" value="To:" />
                    <p:inputMask id="to" value="#{scheduleBean.event.endDate}" mask="99/99/9999">
                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT+2"/>
                    </p:inputMask>

                    <h:outputLabel for="allDay" value="All Day:" />
                    <h:selectBooleanCheckbox id="allDay" value="#{scheduleBean.event.allDay}" />

                    <p:commandButton type="reset" value="Reset" />
                    <p:commandButton id="addButton" value="Save" actionListener="#{scheduleBean.addEvent}" oncomplete="PF('myschedule').update();PF('eventDialog').hide();" />
                </h:panelGrid>
            </p:dialog>   
        </h:form>
    </h:body>
</html>
